use crate::dto;
use serde::{Deserialize, Serialize};
use validator::Validate;
use wanmesh_common::validator::validate_string_is_not_empty;

#[derive(Serialize, Deserialize, Validate, Debug, Clone)]
pub struct SetRulesRequest {
    #[validate(custom(function = "validate_string_is_not_empty"))]
    pub network_acl_id: String,
    pub params: SetRulesParams,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone)]
pub struct SetRulesParams {
    #[serde(default)]
    pub rules: Vec<dto::core::network_acl_rule::AddParams>,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone)]
pub struct AllIngressRulesRequest {
    #[validate(custom(function = "validate_string_is_not_empty"))]
    pub network_acl_id: String,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone)]
pub struct AllEgressRulesRequest {
    #[validate(custom(function = "validate_string_is_not_empty"))]
    pub network_acl_id: String,
}

pub type AllIngressRulesResponseData =
    wanmesh_common::dto::AllResponseData<dto::core::network_acl_rule::NetworkAclRuleItem>;
pub type AllEgressRulesResponseData =
    wanmesh_common::dto::AllResponseData<dto::core::network_acl_rule::NetworkAclRuleItem>;
